package cn.edu.neusoft.yuejian4.yuejian_4.activity;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;

import java.util.List;

import cn.edu.neusoft.yuejian4.yuejian_4.R;
import cn.edu.neusoft.yuejian4.yuejian_4.adapter.ClubClassAdapter;
import cn.edu.neusoft.yuejian4.yuejian_4.adapter.ClubVideoAdapter;
import cn.edu.neusoft.yuejian4.yuejian_4.javaBean.ClubClass;
import cn.edu.neusoft.yuejian4.yuejian_4.javaBean.ClubVideo;
import cn.edu.neusoft.yuejian4.yuejian_4.listener.List_TListener;
import cn.edu.neusoft.yuejian4.yuejian_4.model.ClubModel;

/**
 * Created by Lix on 2018/10/login_bg2.
 */

public class ClubVideoActivity extends AppCompatActivity implements View.OnClickListener {

    private ImageView back;
    private RecyclerView recyclerView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_clubvideo);
        initview();
        initEvent();
        int cid = getIntent().getIntExtra("clubid",1);
        ClubModel clubModel = new ClubModel();
        clubModel.curclubvideo(cid,listener);

    }

    List_TListener<ClubVideo> listener = new List_TListener<ClubVideo>() {
        @Override
        public void onResponse(List<ClubVideo> list) {
            ClubVideoAdapter clubVideoAdapter =new ClubVideoAdapter(getApplicationContext(),list);
            recyclerView.setAdapter(clubVideoAdapter);
        }

        @Override
        public void onFail(String msg) {

        }
    };

    private void initview(){
        recyclerView = (RecyclerView)findViewById(R.id.rv_clubvideo);
        LinearLayoutManager layoutManager = new LinearLayoutManager(this.getApplicationContext());
        layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
        recyclerView.setLayoutManager(layoutManager);
        back = (ImageView)findViewById(R.id.club_video_back);
    }
    private void initEvent(){
        back.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {

        switch (v.getId()){
            case R.id.club_video_back:
                finish();
                break;
        }
    }
}
